/*
 Navicat Premium Data Transfer

 Source Server         : 本地
 Source Server Type    : MySQL
 Source Server Version : 50719
 Source Host           : localhost:3306
 Source Schema         : test_shiro

 Target Server Type    : MySQL
 Target Server Version : 50719
 File Encoding         : 65001

 Date: 08/04/2020 16:40:46
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for permission
-- ----------------------------
DROP TABLE IF EXISTS `permission`;
CREATE TABLE `permission` (
                              `id` int(11) NOT NULL AUTO_INCREMENT,
                              `name` varchar(256) COLLATE utf8mb4_bin NOT NULL COMMENT '权限名',
                              `url` varchar(256) COLLATE utf8mb4_bin DEFAULT '' COMMENT '接口路径',
                              PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='权限表';

-- ----------------------------
-- Records of permission
-- ----------------------------
BEGIN;
INSERT INTO `permission` VALUES (1, 'video_update', '/video/update');
INSERT INTO `permission` VALUES (2, 'video_delete', '/video/delete');
INSERT INTO `permission` VALUES (3, 'video_add', '/video/add');
INSERT INTO `permission` VALUES (4, 'order_list', '/order/list');
INSERT INTO `permission` VALUES (5, 'user_list', '/user/list');
COMMIT;

-- ----------------------------
-- Table structure for role
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
                        `id` int(11) NOT NULL AUTO_INCREMENT,
                        `name` varchar(128) COLLATE utf8mb4_bin NOT NULL COMMENT '角色名',
                        `description` varchar(258) COLLATE utf8mb4_bin NOT NULL DEFAULT '',
                        PRIMARY KEY (`id`),
                        UNIQUE KEY `role_name_uindex` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='角色表';

-- ----------------------------
-- Records of role
-- ----------------------------
BEGIN;
INSERT INTO `role` VALUES (1, 'admin', '普通管理员');
INSERT INTO `role` VALUES (2, 'root', '超级管理员');
INSERT INTO `role` VALUES (3, 'editor', '视频审核人员');
COMMIT;

-- ----------------------------
-- Table structure for role_permission
-- ----------------------------
DROP TABLE IF EXISTS `role_permission`;
CREATE TABLE `role_permission` (
                                   `id` int(11) NOT NULL AUTO_INCREMENT,
                                   `role_id` int(11) NOT NULL,
                                   `permission_id` int(11) NOT NULL,
                                   `remarks` varchar(256) COLLATE utf8mb4_bin DEFAULT '',
                                   PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='角色权限关系表';

-- ----------------------------
-- Records of role_permission
-- ----------------------------
BEGIN;
INSERT INTO `role_permission` VALUES (1, 3, 1, '');
INSERT INTO `role_permission` VALUES (2, 3, 2, '');
INSERT INTO `role_permission` VALUES (3, 3, 3, '');
INSERT INTO `role_permission` VALUES (4, 2, 1, '');
INSERT INTO `role_permission` VALUES (5, 2, 2, '');
INSERT INTO `role_permission` VALUES (6, 2, 3, '');
INSERT INTO `role_permission` VALUES (7, 2, 4, '');
INSERT INTO `role_permission` VALUES (8, 2, 5, '');
COMMIT;

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
                        `id` int(11) NOT NULL AUTO_INCREMENT,
                        `username` varchar(128) COLLATE utf8mb4_bin NOT NULL,
                        `password` varchar(256) COLLATE utf8mb4_bin NOT NULL,
                        `create_time` datetime DEFAULT CURRENT_TIMESTAMP,
                        `salt` varchar(128) COLLATE utf8mb4_bin DEFAULT '',
                        PRIMARY KEY (`id`),
                        UNIQUE KEY `user_username_uindex` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='用户表';

-- ----------------------------
-- Records of user
-- ----------------------------
BEGIN;
INSERT INTO `user` VALUES (1, 'admin', '123456', '2019-10-12 17:06:38', '');
INSERT INTO `user` VALUES (2, 'user', '123456', '2019-10-12 17:06:59', '');
COMMIT;

-- ----------------------------
-- Table structure for user_role
-- ----------------------------
DROP TABLE IF EXISTS `user_role`;
CREATE TABLE `user_role` (
                             `id` int(11) NOT NULL AUTO_INCREMENT,
                             `role_id` int(11) NOT NULL,
                             `user_id` int(11) NOT NULL,
                             `remarks` varchar(256) COLLATE utf8mb4_bin DEFAULT '',
                             PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='用户角色关联表';

-- ----------------------------
-- Records of user_role
-- ----------------------------
BEGIN;
INSERT INTO `user_role` VALUES (1, 1, 1, '');
INSERT INTO `user_role` VALUES (2, 2, 1, '');
INSERT INTO `user_role` VALUES (3, 3, 1, '');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
